package Thread_study.threadpool;

import java.util.concurrent.*;

/**
 *  使用Executors的工具方法直接得到一个线程对象
 */
public class ThreadPoolDemo3 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        // 1，创建固定线程数据的线程池
        ExecutorService pool = Executors.newFixedThreadPool(3);

        pool.execute(new MyRunnableDemo());
        pool.execute(new MyRunnableDemo());
        pool.execute(new MyRunnableDemo());
        pool.execute(new MyRunnableDemo()); // 已经没有多余线程了
    }
}
